<?php 

class Car{
    public $color;
    public $username;
    public function __construct($color,$username)
    {
        $this->color=$color;
    $this->username=$username;
    }

public function use(){
    echo '我是机动⻋！';
}
public function equals($ob1,$ob2){
if(($ob1->color==$ob2->color)&&($ob1->username==$ob2->username))
    return true;
    return false;
   
}
}
// $car1=new Car('张三','54654');
// $car2=new Car('458654','54654');
// $car1->use();
// var_dump($car1->equals($car1,$car2));


class taxi extends Car{
public $company;
public function __construct($company,$color,$username)
{
    $this->company=$company;
    parent::__construct($color,$username);
}
final function ride(){
    echo $this->username."**出租⻋是所属于在***".$this->company.'公司的';
}
function use(){
    echo "出租⻋是提⾼市⺠⽣活质量的重要条件之⼀";
}
function toString(){
   echo  $this->color.'<br>';
   echo  $this->username;
}
}
$taxi=new taxi('dsgdfsg','dfdsf','sfsafsa');
$taxi->ride();
$taxi->use();
$taxi->toString();

class homecar extends taxi{
public $num;
public function __construct($num,$color,$username)
{
    $this->num=$num;
    parent::__construct($num,$color,$username);


}
public function display(){
    echo $this->username.'拥有的'.$this->color.'颜色的私家车有'.$this->num.'座位';
}
}
?>